<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
     <script>
        while(true){
            let num=Math.floor(Math.random()*(9+1)+1)
            let i=+prompt()
            if(num>i){
                alert('数字猜大了，继续猜')
            }else if(num<i){
                alert('数字猜小了，继续猜')
            }else if(num==i){
                alert('猜对了')
                break
            }
        }
    </script>
</body>
</html>